#!/usr/bin/env node
const fs = require('fs');

let opt;
let src;
let lnk;

switch(process.argv.length) {
    case 4:
        src = process.argv[2];
        lnk = process.argv[3];

        fs.linkSync(src, lnk);
        break;

    case 5:
        opt = process.argv[2];
        src = process.argv[3];
        lnk = process.argv[4];

        if(opt === '-s') {
            fs.symlinkSync(src, lnk);
        } else {
            console.log('Wrong!');
        }
        break;

    default:
        console.log('Wrong!');
}
  
// ./14-my-ln.js -s 源文件  创建的链接文件